package models

import (
	"time"
)

type SchoolNewconfig struct {
	Id                    int       `xorm:"not null pk autoincr comment('自增主键') INT(11)"`
	SchoolId              int       `xorm:"not null comment('驾校id外键关联dts_school中id') unique INT(11)" form:"school_id"`
	Name                  string    `xorm:"default '' comment('驾校配置名，如果该配置为文件存放在硬盘上该字段可以是路径') VARCHAR(128)"`
	Open                  string    `xorm:"comment('驾校上班时间') CHAR(8)"`
	Close                 string    `xorm:"comment('驾校下班时间') CHAR(8)"`
	HourseSubject1        int       `xorm:"default 30 comment('科目1总学时') TINYINT(3)"`
	HourseSubject2        int       `xorm:"default 30 comment('科目2总学时') TINYINT(3)"`
	HourseSubject3        int       `xorm:"default 30 comment('科目3总学时') TINYINT(3)"`
	HourseSubject4        int       `xorm:"default 30 comment('科目4总学时') TINYINT(3)"`
	BegintimeRegion       string    `xorm:"comment('上午开始时间') "`
	EndtimeRegion         string    `xorm:"comment('上午结束时间') "`
	AutoCheck             string    `xorm:"default '1' comment('学时自动审核 1：手动，2：自动 3：手动+自动') ENUM('1','2','3')"`
	UpdateTime            time.Time `xorm:"TIMESTAMP"`
	Maxhoursday           int       `xorm:"not null default 4 comment('每天最大培训时间') INT(6)"`
	Maxstoptime           int       `xorm:"default 0 comment('最大停车时间') INT(6)"`
	Leastdistance         int       `xorm:"comment('一次教学日志的最小里程  单位：米') INT(6)"`
	Leasttrajectory       int       `xorm:"comment('轨迹比对最小分段') INT(6)"`
	Pathsimilarity        int       `xorm:"comment('轨迹比对相似度 %') INT(6)"`
	Photoaffecttime       int       `xorm:"comment('不合格照片影响时间') INT(6)"`
	Photosimilarity       int       `xorm:"comment('照片比对相似度，超过设定值 照片无效  单位：%') INT(6)"`
	Isopenphotosimilarity string    `xorm:"default '0' comment('是否开启照片过程照片比对(默认不开启)') ENUM('0','1')"`
	Facesimilarity        int       `xorm:"comment('人脸对比') INT(6)"`
	Faceswitch            string    `xorm:"default '0' comment('终端人脸识别：0-未开启，1-开启') ENUM('0','1')"`
	Facespercent          int       `xorm:"default 0 comment('终端人脸识别百分比例') INT(11)"`
	Isopenfacesimilarity  string    `xorm:"default '0' comment('是否开启人脸比对(默认不开启)') ENUM('0','1')"`
	Isappointment         string    `xorm:"default '0' comment('是否开启预约模式：1-是预约之后才可学车，0-否，没有预约也可以学车') ENUM('0','1')" form:"isappointment"`
	Appointmentbegin      string    `xorm:"default '05:00:00' comment('预约开始时间') DATE" form:"appointmentbegin"`
	Appointmentover       string    `xorm:"default '21:00:00' comment('预约结束时间') DATE" form:"appointmentover"`
	Shuangdan             int       `xorm:"default 1 comment('累计爽单次数') INT(11)"  form:"shuangdan"`
	Xiaodan               int       `xorm:"default 8 comment('一天可以消单的次数') INT(11)" form:"xiaodan"`
	Studentxiaodan        int       `xorm:"default 5 comment('学员可提前几小时消单') INT(11)" form:"studentxiaodan"`
	Schoolxiaodan         int       `xorm:"default 5 comment('驾校可以提前几小时消单') INT(11)" form:"schoolxiaodan"`
	Xiaodantime           int       `xorm:"default 20 comment('消单时间距离订单开始时间差，单位分钟') INT(11)" form:"xiaodantime"`
	Maxorder              int       `xorm:"default 10 comment('最大可约单数') INT(11)" form:"maxorder"`
	Ifevaluation          string    `xorm:"default '0' comment('0-未开启强制评论，1-开始强制评论') ENUM('0','1')" form:"ifevaluation"`
	Punishnum             int       `xorm:"default 1 comment('惩罚天数') INT(11)" form:"punishnum"`
	Holidaybegin          time.Time `xorm:"comment('节假日开始时间') DATE" `
	Holidayover           time.Time `xorm:"comment('节假日结束时间') DATE" `
	Leavetype             string    `xorm:"default '0' comment('请假类型   0自主 1请假') ENUM('0','1')"`
	Subthremoney          float32   `xorm:"default 5.00 FLOAT(5,2)"`
	Subtwomoney           float32   `xorm:"default 5.00 FLOAT(5,2)"`
	Fingerswitch          string    `xorm:"default '0' comment('终端指纹识别开关 0-未开启，1-已开启 ') ENUM('0','1')"`
	Coafacepercent        int       `xorm:"default 0 comment('终端教练人脸识别百分比') INT(11)"`
	Coafaceon             string    `xorm:"default '0' comment('教练终端登录是否开启人脸识别：0-未开启，1-开启') ENUM('0','1')"`
	Spacingtime           string    `xorm:"default '15' comment('拍照间隔时间') ENUM('10','15','5','7')"`
	Studentlive           string    `xorm:"default '0' comment('0  不开启 1 开启') ENUM('0','1')"`
	Coachlive             string    `xorm:"default '0' comment('0不开启 1开启') ENUM('0','1')"`
	Theoryastart          string    `xorm:"default '05:00:00' comment('大课堂上午开始时间') TIME"`
	Theoryaend            string    `xorm:"default '12:00:00' comment('大课堂上午结束时间') TIME"`
	Theorypstart          string    `xorm:"default '12:00:00' comment('大课堂下午开始时间') TIME"`
	Theorypend            string    `xorm:"default '21:00:00' comment('大课堂下午结束时间') TIME"`
	Remoteastart          string    `xorm:"default '00:00:00' comment('远程上午开始时间') TIME"`
	Remoteaend            string    `xorm:"default '12:00:00' comment('远程上午结束时间') TIME"`
	Remotepend            string    `xorm:"default '23:59:59' comment('远程下午结束时间') TIME"`
	Remotepstart          string    `xorm:"default '12:00:00' comment('远程下午开始时间') TIME"`
	Drillastart           string    `xorm:"default '05:00:00' comment('实操上午开始时间') TIME"`
	Drillaend             string    `xorm:"default '12:00:00' comment('实操上午结束时间') TIME"`
	Drillpstart           string    `xorm:"default '12:00:00' comment('实操下午开始时间') TIME"`
	Drillpend             string    `xorm:"default '21:00:00' comment('实操下午结束时间') TIME"`
	Simulatorastart       string    `xorm:"default '05:00:00' comment('模拟器上午开始时间') TIME"`
	Simulatoraend         string    `xorm:"default '12:00:00' comment('模拟器上午结束时间') TIME"`
	Simulatorpstart       string    `xorm:"default '12:00:00' comment('模拟器下午开始时间') TIME"`
	Simulatorpend         string    `xorm:"default '21:00:00' comment('模拟器下午结束时间') TIME"`
	Ispayxueshi           string    `xorm:"default '0' comment('是否开启') ENUM('0','1')"`
	Theme                 string    `xorm:"default '0' comment('监控中心主题颜色') ENUM('0','1','2','3','4','5','6','7')"`
	Outfieldrange         int
	Overspeedrange        int
	Openlive              string `xorm:"default '0' comment('是否开启直播') ENUM('0','1')"`
	Correction            string `xorm:"default '0' comment('驶出围栏是否矫正 ') ENUM('0','1')"`
	CoachNeedPhoto        string `xorm:"default '0' comment('学员退出教练是否退出') ENUM('0','1')"`
	ParkAllow             string `xorm:"default '0' comment('是否允许停车打卡') ENUM('0','1')"`
	ParkAllowS2           string `xorm:"default '0' comment('科目二是否允许停车打卡') ENUM('0','1')"`
	ParkAllowTimeS2       string `xorm:"default '0' comment('科目二是否允许停车打卡') ENUM('0','1')"`
	ParkAllowTimeS3       string `xorm:"default '0' comment('允许停车时间') ENUM('0','1')"`
	ObdDevice             string `xorm:"default '0' comment('允许停车时间') ENUM('0','1')"`
	NeedFinger            string `xorm:"default '0' comment('退出是否需要伸手指') ENUM('0','1')"`
}

func (c *SchoolNewconfig) GetConfigBySchoolId(school_id int) (list SchoolNewconfig, err error) {
	_, err = engine.Table("dts_school_newconfig").Alias("sg").
		Where("sg.school_id = ?", school_id).
		Get(&list)
	return list, err
}
